home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
001-100
/
076-100
/
078
/
mandelvroom
/
menu.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-18
|
7KB
|
339 lines
/***************************************************************************
*
* MandelVroom Menu Manipulation routines
*
* Kevin L. Clague
*
* Copyright (C) 1987
*
**************************************************************************/
#include "mand.h"
extern struct Menu Menu, GenMenu;
extern struct NewScreen NewScreen;
extern struct Screen *screen;
extern struct Window *MandWind, *PalWind, *ContWind;
extern struct NewWindow *NewMand;
extern SHORT MaxCount, Zoom;
extern UBYTE MandType, QuitScreen;
extern USHORT CmdMode;
/*
* Decide what to do for Project menu's Items
*/
ScreenProject(code)
USHORT code;
{
static char File[80] = "", Path[80] = "df1:";
char Name[160];
char *p;
switch (ITEMNUM(code))
{
case LOADITEM:
SetSystemColors(1);
if (get_fname(MandWind,screen,"Load Pics",File,Path)) {
SetSystemColors(0);
strcpy(Name,Path);
if (Name[strlen(Name)-1] != ':') {
strcat(Name,"/");
}
strcat(Name,File);
if (PalWind) {
ClosePalWind();
}
if (ContWind) {
CloseContWind();
}
ClearMenuStrip(MandWind);
LoadCounts(Name);
SetNormPointer();
SetMenuStrip(MandWind, &Menu);
} else {
SetSystemColors(0);
}
break;
case SAVEITEM:
switch (SUBNUM(code)) {
case 0:
p = "Save Pics";
break;
case 1:
p = "Save ILBM";
break;
}
SetSystemColors(1);
if (get_fname(MandWind, screen, p, File, Path )) {
SetSystemColors(0);
strcpy(Name, Path);
if (Name[strlen(Name)-1] != ':') {
strcat(Name,"/");
}
strcat(Name,File);
ClearMenuStrip(MandWind);
switch (SUBNUM(code)) {
case 0:
SaveCounts(Name);
break;
case 1:
SaveILBM(Name);
break;
}
DisplayBeep(screen);
SetNormPointer();
SetMenuStrip(MandWind, &Menu);
} else {
SetSystemColors(0);
}
break;
case GENERATEITEM:
GenerateIt();
break;
case USEITEM:
CloseDisp();
OpenDisp();
break;
case QUITITEM:
QuitScreen = TRUE;
}
} /* DoProjectScreen */
/*
* Decide what to do for Edit menu's Items
*/
EditScreen(code)
USHORT code;
{
float gapy,gapx;
extern LONG NavLeft,NavTop,NavBot,NavRight;
switch (ITEMNUM(code))
{
case COLORITEM:
OpenPalWind();
break;
case DEPTHITEM:
NewScreen.Depth = SUBNUM(code) + 1;
if (NewScreen.ViewModes & HIRES)
if (NewScreen.Depth > 4) {
NewScreen.Depth = 4;
InitDepthSubs();
}
break;
case CONTOURITEM:
OpenContWind();
break;
case VIEWMODEITEM:
EditScreenViewModes(code);
break;
case GENERATORITEM: /* generator type */
MandType = SUBNUM(code);
break;
case ZOOMITEM:
switch (SUBNUM(code)) {
case ZOOMINON:
if (Zoom == 0) {
CmdMode = STARTBOX;
SetToPointer();
}
break;
case ZOOMINOFF:
if (Zoom == 1) {
DrawExtras(NavLeft, NavTop, NavRight, NavBot );
DrawBox(NavLeft, NavTop, NavRight, NavBot );
Zoom = 0;
}
}
break;
case COUNTITEM:
switch (SUBNUM(code)) {
case 0:
MaxCount = 32;
break;
case 1:
MaxCount = 64;
break;
case 2:
MaxCount = 128;
break;
case 3:
MaxCount = 256;
break;
case 4:
MaxCount = 512;
break;
case 5:
MaxCount = 1023;
break;
}
}
} /* EditScreen */
/*
* Modify the NewScreens ViewModes to match the menu
*/
EditScreenViewModes(code)
USHORT code;
{
switch (SUBNUM(code))
{
case HIRESSUB:
if (NewScreen.ViewModes & HIRES) {
NewScreen.Width = 320;
NewScreen.ViewModes &= ~HIRES;
} else {
NewScreen.Width = 640;
NewScreen.ViewModes |= HIRES;
NewScreen.ViewModes &= ~EXTRA_HALFBRITE;
if (NewScreen.Depth > 4)
NewScreen.Depth = 4;
}
break;
case INTERLACESUB:
if (NewScreen.ViewModes & INTERLACE) {
NewScreen.ViewModes &= ~INTERLACE;
NewScreen.Height = 200;
} else {
NewScreen.ViewModes |= INTERLACE;
NewScreen.Height = 400;
}
break;
case HALFBRITESUB:
if (NewScreen.ViewModes & EXTRA_HALFBRITE) {
NewScreen.ViewModes &= ~EXTRA_HALFBRITE;
NewScreen.Depth = 5;
} else {
NewScreen.ViewModes |= EXTRA_HALFBRITE;
NewScreen.ViewModes &= ~HIRES;
NewScreen.Depth = 6;
}
break;
}
InitViewModesSubs();
InitDepthSubs();
} /* EditScreenViewMode */
/*
* Set up Menu's check marks to reflect viewmodes.
*/
InitViewModesSubs()
{
SHORT i;
extern struct MenuItem ViewModeSubs[];
for (i = HIRESSUB; i <= HALFBRITESUB; i++) {
ViewModeSubs[i].Flags &= ~CHECKED;
switch (i) {
case HIRESSUB:
if (NewScreen.ViewModes & HIRES)
ViewModeSubs[i].Flags |= CHECKED;
break;
case INTERLACESUB:
if (NewScreen.ViewModes & INTERLACE)
ViewModeSubs[i].Flags |= CHECKED;
break;
case HALFBRITESUB:
if (NewScreen.ViewModes & EXTRA_HALFBRITE)
ViewModeSubs[i].Flags |= CHECKED;
break;
}
}
} /* InitViewModesSubs */
/*
* Set up Menu's check marks to reflect Depth.
*/
InitDepthSubs()
{
SHORT i;
extern struct MenuItem DepthSubs[];
for (i = 0; i <= 6; i++) {
DepthSubs[i].Flags &= ~CHECKED;
}
DepthSubs[NewScreen.Depth-1].Flags |= CHECKED;
} /* InitScreenViewMode */
/*
* Set up Menu's check marks to reflect Generator Type
*/
InitGenSubs()
{
SHORT i;
extern struct MenuItem GenerateSubs[];
extern UBYTE MandType;
for (i = 0; i <= 1; i++) {
GenerateSubs[i].Flags &= ~CHECKED;
}
GenerateSubs[MandType].Flags |= CHECKED;
} /* InitGenSubs */
/*
* Set up Menu's check marks to reflect Iteration count
*/
InitMaxISubs()
{
SHORT i;
extern struct MenuItem CountSubs[];
extern SHORT MaxCount;
for (i = 0; i <= 1; i++) {
CountSubs[i].Flags &= ~CHECKED;
}
if (MaxCount <= 32)
CountSubs[0].Flags |= CHECKED;
else
if (MaxCount <= 64)
CountSubs[1].Flags |= CHECKED;
else
if (MaxCount <= 128)
CountSubs[2].Flags |= CHECKED;
else
if (MaxCount <= 256)
CountSubs[3].Flags |= CHECKED;
else
if (MaxCount <= 512)
CountSubs[4].Flags |= CHECKED;
else
if (MaxCount <= 1024)
CountSubs[5].Flags |= CHECKED;
} /* InitGenSubs */